package ace.oauth2.provider.base.autoconfig;

import ace.fw.redisson.autoconfigure.RedissonAutoConfigure;
import org.redisson.client.codec.Codec;
import org.redisson.codec.FstCodec;
import org.springframework.boot.autoconfigure.AutoConfigureBefore;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.oauth2.common.OAuth2AccessToken;
import org.springframework.security.oauth2.provider.OAuth2Authentication;

/**
 * @author Caspar
 * @contract 279397942@qq.com
 * @create 2020/1/14 15:57
 * @description 配置redisson json 序列化与反序列化 oauth2的对象 {@link OAuth2AccessToken} {@link OAuth2Authentication}
 */
@AutoConfigureBefore(value = {OAuth2AuthorizationServerSupportConfig.class, RedissonAutoConfigure.class})
@Configuration
public class RedissonConfig {

    @Bean
    @ConditionalOnMissingBean
    public Codec codec() {
        Codec codec = new FstCodec();
        return codec;
    }


}
